#ifndef _TAIIC_LM_H
#define _TAIIC_LM_H

#include "stdio.h"
#include"rknn_api.h"
#include "taiic_rknn.h"
#include "taiic_lm.h"

#define LM_IMG_WIDTH 112
#define LM_IMG_HEIGHT 112
#define LM_IMG_CHANNEL 1
#define LM_IMG_BATCH 1

#define RESIZE_IMG_WIDTH 32
#define RESIZE_IMG_HEIGHT 32
#define RESIZE_IMG_CHANNEL 1
#define RESIZE_IMG_BATCH 1

#define BEFORE_CROP 320

#define LM_MODEL_PATH "/oem/usr/model/lm.rknn"

#define EXTEND_PIXEL 25

// input [1, 112, 112, 1]
// output [x0, y0, x1, y1, x2, y2, x3, y4]

typedef  struct rkTOOLKIT_LM_S
{
    char *modelPath;
    rknn_context context; //模型上下文
    rknn_input_output_num io_num; //模型输入输出信息，结构体
    rknn_tensor_attr input_attrs[1];  //模型输入属性
    rknn_tensor_attr output_attrs[1]; //模型输出属性
 
    rknn_tensor_mem *input_mems[1]; //模型输入
    rknn_tensor_mem *output_mems[1]; //模型输出

    // rknn_tensor_attr orig_output_attrs[3]; //模型orig输出属性
}LM_TOOLKIT_MODEL_CTX_S;


int lm_rknn_toolkit_config_init(LM_TOOLKIT_MODEL_CTX_S *ctx);
int lm_rknn_toolkit_io_init(LM_TOOLKIT_MODEL_CTX_S *ctx);
int lm_rknn_toolkit_data_refresh(LM_TOOLKIT_MODEL_CTX_S *ctx, unsigned char* input_data);

LM_RESULT_S lm_toolkit_result(LM_TOOLKIT_MODEL_CTX_S *ctx);
LM_RESULT_S lm_toolkit_result_parameter(LM_TOOLKIT_MODEL_CTX_S *ctx);
LM_RESULT_S lm_toolkit_result_parameter_extend25(LM_TOOLKIT_MODEL_CTX_S *ctx);


#endif //_TAIIC_LM_H